/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2024-01-15 10:25:47
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-03-26 09:52:59
 * @FilePath: /yt-devops/lib/model/device_obj/property_group_model.g.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

part of 'property_group_model.dart';

PropertyGroupModel _$PropertyGroupModelFromJson(Map<String, dynamic> json) =>
    PropertyGroupModel(
      id: json['id'] as String,
      name: json['name'] as String?,
      promptRule: json['promptRule'] == null
          ? null
          : PromptRuleModel.fromJson(json['promptRule']),
      authority: json['authority'] == null
          ? null
          : List.generate(
              json['authority'].length,
              (index) =>
                  AuthorityModelConfig.fromJson(json['authority'][index]),
            ),
      parentId: json['parentId'] as String?,
      showType: $enumDecodeNullable(
          _$DeviceModelShowTypeEnumMap, json['showType'],
          unknownValue: DeviceModelShowType.others),
    )..setChildren = List.generate(json['children']?.length ?? 0,
        (index) => PropertiesModel.fromJson(json['children'][index]));

Map<String, dynamic> _$PropertyGroupModelToJson<T extends ProductConfigModel>(
        PropertyGroupModel instance) =>
    <String, dynamic>{
      'id': instance.id,
      'name': instance.name,
      'parentId': instance.parentId,
      'promptRule': instance.promptRule,
      'showType': _$DeviceModelShowTypeEnumMap[instance.showType],
    };

const _$DeviceModelShowTypeEnumMap = {
  DeviceModelShowType.hideName: 1,
  DeviceModelShowType.input: 2,
  DeviceModelShowType.picker: 3,
  DeviceModelShowType.switcher: 4,
  DeviceModelShowType.switchButton: 5,
  DeviceModelShowType.grid: 6,
  DeviceModelShowType.button: 7,
};
